package com.wd.db;
import java.sql.Connection;
import java.sql.SQLException;

import com.jolbox.bonecp.BoneCP;
import com.jolbox.bonecp.BoneCPConfig;



public class BoneCPConn {
	public static BoneCP connectionPool = null;
	    public BoneCPConn() {   
	     }   
	  
	    public static void init() 
	    {
	    	try {   
	    	BoneCPConfig config = new BoneCPConfig();  
	    	Class.forName("com.mysql.jdbc.Driver"); 
	    	 config.setJdbcUrl("jdbc:mysql://192.168.0.144:3306/Mutil_TexasPoker?useUnicode=true&amp;characterEncoding=GBK"); 
	    	 config.setUsername("long");
	    	 config.setPassword("1234");
	    	 config.setMinConnectionsPerPartition(30);
	    	 config.setMaxConnectionsPerPartition(120);
	    	 config.setPartitionCount(3);
	    	 connectionPool= new BoneCP(config);
	        } catch (Exception e) {   
	            System.out.println("���ӻ�ȡʧ��");   
	        }   
	    }   
	    public static synchronized Connection getConnection() throws  SQLException {   
	                       return connectionPool.getConnection(); 
	     }   
}

